<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/jquery-3.2.1.js"></script>
    <style>
      #div{
          width: 100px;
          height: 100px;
          background-color: red;
      }
    </style>
</head>
<body>
    <div id="div">

    </div>
    <button id="btn">btn</button>
   <script>
        $("#btn").click(function(){
           if($("#div").is(":visible")){
               $("#div").hide(1000);
           }else{
               $("#div").show(1000);
           }
        })
   </script>
</body>
</html>